/**
 * @file STL_HttpResponse.h
 * @author Derek Liu (yjkhtddx@sina.com)
 * @brief 
 * @version 0.1
 * @date 2021-02-19
 * 
 * @copyright Copyright Sci-Tech Laboratories (c) 2021
 * 
 */

#ifndef __STL_HTTP_RESPONSE_H__
#define __STL_HTTP_RESPONSE_H__

#include <string>
#include "STL_Json.h"

namespace STL
{
    // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
    class STL_HttpResponse
    {
    public:
        STL_HttpResponse();
        ~STL_HttpResponse() = default;

    public:
        void setCode(int statusCode, std::string phrase = "");
        void setBody(std::string body);
        void setContentType(std::string type);
        void setBodyFromFile(std::string filePath);
        void setBodyFromJson(JSONCPP::Value body);
    public:
        std::string genHttpMessage();

    private:
        std::string m_version;
        int m_code;
        std::string m_phrase;
        std::map<std::string, std::string> m_headers;
        std::string m_body;
    };
}

#endif //__STL_HTTP_RESPONSE_H__
